<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<!--<link href="/css/web/themes/about.css" rel="stylesheet">-->
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<link type="text/css" href="/css/cultivateWeb/style/my.css" rel="stylesheet">
<link rel="stylesheet" href="/css/certificateWeb/stationApplyFor/stationApplyFor.css">
<body id="body">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main" >
    <section class="sec_1">
        <div class="div_1">
            <ul>
                    <li><a href="/certificate/my">个人信息</a></li>
                    <li class="this"><a href="/certificate/isResume">我的简历</a></li>
                    <li><a href="/certificate/infoRecordList">表单提交记录</a></li>
                    <li><a href="/certificate/expertRecordList">专家申请记录</a></li>
                    <li><a href="/certificate/stationRecordList">考核站点申请记录</a></li>
                    <li><a href="/certificate/stationPxRecordList">培训基地申请记录</a></li>
                    <li><a href="/certificate/gradeQuery">成绩查询</a></li>
                    <li><a href="/certificate/message">消息中心</a></li>
                    <li onclick="mock2(this)" data-type="2"><a>幼儿照护初级模拟考试</a></li>
                    <li onclick="mock2(this)" data-type="1"><a>幼儿照护中级模拟考试</a></li>
                    <li onclick="mock2(this)" data-type="0"><a>幼儿照护高级模拟考试</a></li>
                </ul>
            </div>
            <div class="div_2" style="margin-top:0">
                <div id="info"></div>
                <div style="display:none;" id="edit"></div>
            </div>
            <div style="clear: both"></div>
        </section>
    </main>
        <div style="margin-bottom: 50px;display: inline-block"></div>
    </div>
    <!-- footer ------------------------------------------------------- -->
    <div th:include="certificateWeb/headFoot :: footer"></div>
</body>
<script src="/js/layui/lay/modules/layer.js"></script>
<script type="text/javascript" src="/js/mobile.js"></script>
<script>
    $(function () {
        ajaxToken("/jzApi/recruitment/selResume", "GET", {}, function (res) {
            if (res != null) {
                var info = '';
                var a = '';
                if (res.state == 0) {
                    a = '<span id="yc" style="float: right"><label><label style="color: #666">（当状态为已上线时，招聘公司可看到您的简历）</label>&nbsp;&nbsp;当前状态：已上线</label><input class="edit" onclick="changeState(\'' + 1 + '\',' + '\'' + res.id + '\');" type="button" value="下线" /></span>'
                } else {
                    a = '<span id="xs" style="float: right"><label><label style="color: #666">（当状态为已上线时，招聘公司可看到您的简历）</label>&nbsp;&nbsp;当前状态：已隐身</label><input onclick="changeState(\'' + 0 + '\',' + '\'' + res.id + '\');" class="edit" type="button" value="上线" /></span>';
                }
                var b = '';
                if (res.sex == 0) {
                    b = "未知"
                }
                if (res.sex == 1) {
                    b = "男"
                }
                if (res.sex == 2) {
                    b = "女"
                }
                var d = '';
                if (res.jobNature == 0) {
                    d = "全职"
                }
                if (res.jobNature == 1) {
                    d = "兼职"
                }
                if (res.jobNature == 2) {
                    d = "实习"
                }
                var e = '';
                if (res.applyState == 0) {
                    e = "立即到岗"
                }
                if (res.applyState == 1) {
                    e = "月内到岗"
                }
                if (res.applyState == 2) {
                    e = "考虑机会"
                }
                if (res.applyState == 3) {
                    e = "暂不考虑"
                }
                var y = '';
                if (res.isPush == 0) {
                    y = "否"
                }
                if (res.isPush == 1) {
                    y = "是"
                }
                var c = new Date().getFullYear() - new Date(res.dateOfBirth).getFullYear();
                // console.log("log = " , new Date(res.dateOfBirth).getFullYear());

                //------------------荣获证书---------------------//
                var cer = JSON.parse(res.certificate);
                var rhzs = '';
                if (cer == null) {
                    rhzs = '<div style="margin-top:20px;width: 100%">' +
                        '    <span class="jl_zs"></span>' +
                        '    <span class="jl_date"></span>' +
                        '</div>';
                } else {
                    cer.forEach(function (item, index) {
                        rhzs += '<div style="margin-top:20px;width: 100%">' +
                            '    <span class="jl_zs">' + item.zsName + '</span>' +
                            '    <span class="jl_date">' + item.zsTime + '</span>' +
                            '</div>';
                    });
                }


                //------------------教育经历---------------------//
                var edu = JSON.parse(res.educationExperience);
                var jyjl = '';
                edu.forEach(function (item, index) {
                    jyjl += '<div style="margin-top:20px">' +
                        '       <span class="jl_sclTime">' + item.rxTime + ' - ' + item.byTime + '</span>' +
                        '       <span class="jl_school">' + item.bySchool + '</span>' +
                        '    </div>';
                })

                //------------------工作经历---------------------//
                var work = JSON.parse(res.workExperience);
                var gzjl = '';
                work.forEach(function (item, index) {
                    gzjl += '<div style="margin-top:20px">' +
                        '       <span class="jl_sclYear">' + item.rzTime + ' - ' + item.lzTime + '</span>' +
                        '       <span class="jl_gs">' + item.gsName + '</span>' +
                        '       <span class="jl_zw">职位：' + item.zwName + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 薪资：' + item.xsNum + '/月</span>' +
                        '       <span class="jl_ms">' + item.zwDescribe + '</span>' +
                        '   </div>';
                })

                //------------------项目经验---------------------//
                var pro = JSON.parse(res.project);
                var xmjy = '';
                pro.forEach(function (item, index) {
                    xmjy += '<div style="margin-top:20px">' +
                        '       <span class="jl_sclYear">' + item.xmStartTime + ' - ' + item.xmEndTime + '</span>' +
                        '       <span class="jl_gs">' + item.xmName + '</span>' +
                        '       <span class="jl_ms">' + item.xmDescribe + '</span>' +
                        '   </div>';
                })

                console.log("pro == ", pro);


                info = '<div style="width: 940px; margin: 40px auto 20px auto">' +
                    '<input type="hidden" value="' + res.state + '" id="state" />' +
                    '<span style="float: right;margin-right: 20px"><a href="/certificate/iResume"><input class="edit"  id="bj" type="button" value="编辑" /></a></span>' +
                    a +
                    '</div>' +
                    '<div style="clear: both; margin-bottom: 20px"></div>' +
                    '<section style="width:940px;border: 1px #e6e6e6 solid;margin: 0 auto;padding: 10px">' +
                    '<div class="jl_1">' +
                    '<div class="jl_2" style="width: 100%">' +
                    '   <span style="width: 920px;display:inline-block"><img src="' + res.headPortrait + '" class="jl_img"></span>' +
                    '   <span class="jl_name">' + res.userName + '</span>' +
                    '   <span class="jl_jb">' + b + ' | ' + c + '岁 | ' + res.workYears + '年工作经验</span>' +
                    '</div>' +
                    '</div><div style="clear: both"></div>' +
                    '</div>' +
                    '<div class="jl_xx" id="userInfo">' +
                    '   <span class="jl_xx_1">个人信息</span><hr class="jl_hr" />' +
                    '   <div style="margin-top:15px">' +
                    '       <span class="jl_xx_2">联系电话：' + res.mobile + '</span>' +
                    '       <span class="jl_xx_2">个人邮箱：' + res.email + '</span>' +
                    '       <span class="jl_xx_2">出生年月：' + res.dateOfBirth + '</span>' +
                    '       <span class="jl_xx_2">籍&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;贯：' + res.nativePlace + '</span>' +
                    '       <span class="jl_xx_2">毕业学校：' + res.graduatedFrom + '</span>' +
                    '       <span class="jl_xx_2">期望职业：' + res.desiredOccupation + '</span>' +
                    '       <span class="jl_xx_2">期望薪资：' + res.expectedSalary + '</span>' +
                    '       <span class="jl_xx_2">工作性质：' + d + '</span>' +
                    '       <span class="jl_xx_2">求职状态：' + e + '</span>' +
                    '       <span class="jl_xx_2">工作地点：' + res.jobAddress + '</span>' +
                    '       <span class="jl_xx_2">是否推送：' + y + '</span>' +
                    '   </div>' +
                    '</div>' +
                    '<div style="margin-bottom: 70px" id="jy">' +
                    '   <span class="jl_xx_1">教育经历</span><hr class="jl_hr" />' + jyjl +
                    '</div>' +
                    '<div style="margin-bottom: 70px" id="gz">' +
                    '   <span class="jl_xx_1">工作经历</span><hr class="jl_hr" />' + gzjl +

                    '</div>' +
                    '<div style="margin-bottom: 70px" id="xm">' +
                    '   <span class="jl_xx_1">项目经验</span><hr class="jl_hr" />' + xmjy +
                    '</div>' +
                    '<div style="margin-bottom: 70px" id="zs">' +
                    '   <span class="jl_xx_1">荣获证书</span><hr class="jl_hr" />' + rhzs +

                    '</div>' +
                    '<div style="margin-bottom: 70px">' +
                    '   <span class="jl_xx_1">专业技能</span><hr class="jl_hr" />' +
                    '   <div style="margin-top:20px">' +
                    '       <span class="jl_ms">' + res.skills + '</span>' +
                    '   </div>' +
                    '</div>' +
                    '<div style="margin-bottom: 140px">' +
                    '   <span class="jl_xx_1">自我评价</span><hr class="jl_hr" />' +
                    '   <div style="margin-top:20px">' +
                    '       <span class="jl_ms">' + res.selfEvaluation + '</span>' +
                    '   </div>' +
                    '</div>' +
                    '<div style="clear: both;"></div>' +
                    '</section>';
                $("#info").html(info);

            } else {
                location.href="/certificate/appendResume"
            }


        })
    });




    function changeState(state, id) {
        ajaxToken("/jzApi/recruitment/updChangeState", "GET",
            {
                id: id,
                state: state
            }, function (res) {
                window.location.reload();
            })
    }


    function edit(id) {
        $("#edit").css("display", "block");
        $("#info").css("display", "none");
        

    }

    function save() {
        var workYears = $("#workYears").val();
        var nativePlace = $("#nativePlace").val();
        var graduatedFrom = $("#graduatedFrom").val();
        var expectedSalary = $("#expectedSalary").val();
        var selfEvaluation = $("#selfEvaluation").val();
        var url = location.search;
        var str = url.substr(1);
        if (workYears == '' || nativePlace == '' || graduatedFrom == '' || expectedSalary == '' || selfEvaluation == '') {
            layer.msg("基本信息不能为空");
            return false
        }
        ajaxTokenForm("/jzApi/recruitment/updResume", "POST", {
            id: $("#reId").val(),
            workExperience: $("#workExperience").val(),
            workYears: workYears,
            nativePlace: nativePlace,
            graduatedFrom: graduatedFrom,
            desiredOccupation: $("#desiredOccupation").val(),
            expectedSalary: expectedSalary,
            selfEvaluation: selfEvaluation,
            educationExperience: $("#educationExperience").val()

        }, function () {
            if (str.indexOf("2") != -1) {
                location.href = "/certificate/mock?grade=2";
            } else if (str.indexOf("1") != -1) {
                location.href = "/certificate/mock?grade=1";
            } else if (str.indexOf("0") != -1) {
                location.href = "/certificate/mock?grade=0";
            }
            // location.href = '/certificate/iResume';
        })
    }

</script>

</html>